<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<title>用户登录</title>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="__CSS__/base.css">
	<link rel="stylesheet" href="__CSS__/iconfont.css">
	<link rel="stylesheet" href="__CSS__/reg.css">
</head>
<body>
<div id="ajax-hook"></div>
<div class="wrap">
	<div class="wpn">
		<div class="form-data find_password">
			<h4>用户注册</h4>
			<p class="right_now">已有账号，<a href="{:url('index/index')}">马上登录</a></p>
			<div style="width: 100%;height: 300px; overflow:auto">
				<p class="p-input pos">
					<label>账号 (必填)</label>
					<input type="text" name="userLoginName" id="loginName">
				</p>
				<p class="p-input pos">
					<label>密码 (必填)</label>
					<input type="password" name="userPassword" id="password">
				</p>
				<p class="p-input pos">
					<label>用户名 (必填)</label>
					<input type="text" name="name" id="name">
				</p>
				<p class="p-input pos">
					<label>地址</label>
					<input type="text" name="address" id="address" >
				</p>
				<p class="p-input pos">
					<label>公司名称</label>
					<input type="text" name="company" id="company">
				</p>
				<p class="p-input pos">
					<label>国家</label>
					<input type="text" name="country" id="country">
				</p>
				<p class="p-input pos">
					<label>描述</label>
					<input type="text" name="description" id="description">
				</p>
				<p class="p-input pos">
					<label>名</label>
					<input type="text" name="firstName" id="firstName">
				</p>
				<p class="p-input pos">
					<label>姓</label>
					<input type="text" name="lastName" id="lastName">
				</p>
				<p class="p-input pos">
					<label>性别</label>
					<select id="male" style="border: none; width: 50px;height: 20px; margin: 12px 0 0 50px;">
						<option value="true">男</option>
						<option selected value="false">女</option>
					</select>
				</p>
				<p class="p-input pos">
					<label>职业</label>
					<input type="text" name="job" id="job">
				</p>
				<p class="p-input pos">
					<label>手机号</label>
					<input type="text" name="mobile" id="mobile">
				</p>
				<p class="p-input pos">
					<label>电话号码</label>
					<input type="text" name="phone" id="phone">
				</p>
				<p class="p-input pos">
					<label>昵称</label>
					<input type="text" name="nickName" id="nickName">
				</p>
				<p class="p-input pos">
					<label>地区/城市</label>
					<input type="text" name="state" id="state">
				</p>
				<p class="p-input pos">
					<label>邮编</label>
					<input type="text" name="zipcode" id="zipcode">
				</p>
			</div>

			<button class="lang-btn next" id="register">注册</button>
			<p class="right">Powered by © 2018</p>
		</div>
	</div>
</div>
<script src="__JS__/jquery.js"></script>
<script src="__JS__/agree.js"></script>
<script src="__JS__/layui/layui.all.js"></script>
<script type="text/javascript">

    $("#register").click(function () {
        var user = $.trim($("input[name='userLoginName']").val());
        var pass = $.trim($("input[name='userPassword']").val());
        var name = $.trim($("input[name='name']").val());
        if(user==''){layer.open({title: '提示',content: '请填写账号'});return}
        if(pass==''){layer.open({title: '提示',content: '请填写密码'});return}
        if(name==''){layer.open({title: '提示',content: '请填写用户名'});return}
        var data = {
            userLoginName:user,userPassword:pass,name:name,
			address:$.trim($("input[name='address']").val()),
            company:$.trim($("input[name='company']").val()),
            country:$.trim($("input[name='country']").val()),
            job:$.trim($("input[name='job']").val()),
            description:$.trim($("input[name='description']").val()),
            firstName:$.trim($("input[name='firstName']").val()),
            lastName:$.trim($("input[name='lastName']").val()),
            mobile:$.trim($("input[name='mobile']").val()),
            phone:$.trim($("input[name='phone']").val()),
            nickName:$.trim($("input[name='nickName']").val()),
            zipcode:$.trim($("input[name='zipcode']").val()),
            state:$.trim($("input[name='state']").val()),
            male:$("#male").val()
		}

        $.post("{:url('index/Sync/register')}",data,function (rs) {
            if(rs.msg.code == 0){
                layer.open({
                    title: '提示信息',content: "注册成功",closeBtn: 0,icon:1,btn: ['去登录'],
                    yes: function(index, layero){
                        location.href="{:url('index/index/index')}"
                    }
                });
            }else{
                layer.open({
                    title: 'error'
					,icon:5
                    ,content: rs.msg.message
                });
            }
        })
    })
</script>
</body>
</html>